// $Id: noderequestfileparameters.h 39 2004-09-24 15:03:42Z jonas $
#ifndef NODEREQUESTFILEPARAMETERS_H
#define NODEREQUESTFILEPARAMETERS_H

/**
 * This class holds parameters for the Node::requestFile method to ease the
 * preassure on the stack and to simplify sending parameters to loggers.
 */
class NodeRequestFileParameters {
public:
	NodeRequestFileParameters(unsigned int guid, int hopsToLive, File *file, bool insert) : m_guid(guid), m_hopsToLive(hopsToLive), m_hopCount(0), m_file(file), m_insert(insert), m_fileOwner(0), m_insertComplete(false) {}

	/**
	 * A Global Unique Identifier for a search request.
	 */
	unsigned int m_guid;

	/**
	 * Freenet style hops to live counter. This counter is decreased at each
	 *  node and the request is failed if no file has been found when the
	 *  counter has reached zero.
	 */
	int m_hopsToLive;

	/**
	 * The number of nodes a request has visited
	 */
	int m_hopCount;

	/**
	 * A pointer to the file to request.
	 */
	File *m_file;

	/**
	 * True if this is an insert querie. False if it is a request querie.
	 */
	bool m_insert;

	/**
	 * A pointer to the node that had the requested file. (This can be changed
	 * at any node to point to itself or any other node (freenet style) in
	 * order to confuse.
	 */
	Node *m_fileOwner;

	/**
	 * This is set to true when (if) an insert query hits bottom without
	 * conflicts or other errors.
	 */
	bool m_insertComplete;
};

#endif
